package com.csc.springcore.main;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.csc.springcore.services.EmployeeService;

public class EmployeeApp {

	/**
	 * Testing the spring core features and AOP feature in the employee
	 * management web applcation
	 * 
	 * @param Commandline params
	 */
	public static void main(String[] args) {

		ApplicationContext context = new ClassPathXmlApplicationContext(
				"Beans.xml");

		EmployeeService employeeService = (EmployeeService) context
				.getBean("employeeService");

		// Print all employees in the db
		employeeService.printEmployeeList();

		// Find an employee with id = 1
		employeeService.findEmployeeById(1);

		// Close the Application Context
		((ConfigurableApplicationContext) context).close();
	}
}